package windows

type base interface {
	Sum() int
	Reset()
}

type UpdateForCounter interface {
	Update()
}

type IncrForCounter interface {
	base
	Incr()
}

type BucketOption func(*bucket) error
type NewIncrForCounter func() IncrForCounter 
type NewUpdateForCounter func() UpdateForCounter 

type bucket struct {
	//Options    []BucketOption
	Adder      IncrForCounter
	MaxUpdater UpdateForCounter
}

func NewBucket(opts ...BucketOption) *bucket {
	o := ParseOptions(opts...)
	b := &bucket{}
	for _, v := range o {
		v(b)
	}
	return b
}

func (b *bucket) GetAdder() IncrForCounter {
	if b != nil {
		return b.Adder
	}
	return nil
}

func (b *bucket) GetMaxUpdater() UpdateForCounter {
	if b != nil {
		return b.MaxUpdater
	}
	return nil
}
